package phoenix.web.page_objects;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;

import phoenix.core.PhoenixManager;
import phoenix.core.base.extensions.PageBaseWebExt;
import phoenix.core.config.extensions.ConfigExt;
import phoenix.core.data_models.UserProfileDataModel;
import phoenix.core.data_models.UserProfileDataModel.LookingFor;
import phoenix.core.data_models.UserProfileDataModel.ProfileDetails;
import phoenix.web.locators.base.MyProfileLocatorsBase;

public class MyProfilePage extends PageBaseWebExt
{
	UserProfileDataModel dataModel = new UserProfileDataModel(manager);

	/**
	 * Initializes the MyProfilePage
	 * @param p_manager PhoenixManager instance
	 */
	public MyProfilePage(PhoenixManager p_manager)
	{
		super(p_manager);
	}

	/**
	 * Gets web elements by site
	 * @return MyProfilePageLocatorsBase instance
	 */
	public MyProfileLocatorsBase elements()
	{
		switch (manager.testModel().getSiteName())
		{
			case ConfigExt.SITE_ID_CLICKANDFLIRT:
			{
				return new phoenix.web.locators.clickandflirt.MyProfileLocators();
			}
			case ConfigExt.SITE_ID_LOCALSGOWILD:
			{
				return new phoenix.web.locators.localsgowild.MyProfileLocators();
			}
			case ConfigExt.SITE_ID_CHEECKYLOVERS:
			{
				return new phoenix.web.locators.cheekylovers.MyProfileLocators();
			}
			case ConfigExt.SITE_ID_EBONYFLIRT:
			{
				return new phoenix.web.locators.ebonyflirt.MyProfileLocators();
			}
			case ConfigExt.SITE_ID_WILDBUDDIES:
			{
				return new phoenix.web.locators.wildbuddies.MyProfileLocators();
			}
			case ConfigExt.SITE_ID_FLIRT:
			{
				return new phoenix.web.locators.flirt.MyProfileLocators();
			}
			case ConfigExt.SITE_ID_FOREIGNGIRLFRIEND:
			{
				return new phoenix.web.locators.foreigngirlfriend.MyProfileLocators();
			}
			case ConfigExt.SITE_ID_BENAUGHTY:
			{
				return new phoenix.web.locators.benaughty.MyProfileLocators();
			}
			case ConfigExt.SITE_ID_NAUGHTYFEVER:
			{
				return new phoenix.web.locators.naughtyfever.MyProfileLocators();
			}
			case ConfigExt.SITE_ID_MATUREDATING:
			{
				return new phoenix.web.locators.maturedating.MyProfileLocators();
			}
			default:
			{
				return null;
			}
		}
	}

	public void clickEditMainInfo()
	{
		log().info("Click edit main info");

		wd().waitForPresence(elements().btnEditMainInfo, "Button 'Edit Main info'");

		if (manager.testModel().getBrowserName().equals(manager.config().BROWSER_IEXPLORER))
		{
			WebElement webElement = manager.wd().getWebElement(elements().btnEditMainInfo);
			wd().scrollWithOffset(webElement, 0, -200);
		}

		wd().click(elements().btnEditMainInfo);
	}

	public void clickSaveMainInfo()
	{
		log().info("Click save main info");

		wd().waitForPresence(elements().btnSaveMainInfo, "Button 'Save Main info'");

		if (manager.testModel().getBrowserName().equals(manager.config().BROWSER_IEXPLORER))
		{
			WebElement webElement = manager.wd().getWebElement(elements().btnSaveMainInfo);
			wd().scrollWithOffset(webElement, 0, -200);
		}

		wd().click(elements().btnSaveMainInfo);
	}

	public void clickCancelMainInfo()
	{
		log().info("Click cancel main info");

		wd().waitForPresence(elements().btnCancelMainInfo, "Button 'Cancel Main info'");

		if (manager.testModel().getBrowserName().equals(manager.config().BROWSER_IEXPLORER))
		{
			WebElement webElement = manager.wd().getWebElement(elements().btnCancelMainInfo);
			wd().scrollWithOffset(webElement, 0, -200);
		}

		wd().click(elements().btnCancelMainInfo);
	}

	public void clickEditPersonalInfo()
	{
		log().info("Click edit personal info");

		wd().waitForPresence(elements().btnEditPersonalInfo, "Button 'Edit Personal info'");

		if (manager.testModel().getBrowserName().equals(manager.config().BROWSER_IEXPLORER))
		{
			WebElement webElement = manager.wd().getWebElement(elements().btnEditPersonalInfo);
			wd().scrollWithOffset(webElement, 0, -200);
		}

		wd().click(elements().btnEditPersonalInfo);
	}

	public void clickSavePersonalInfo()
	{
		log().info("Click save personal info");

		wd().waitForPresence(elements().btnSavePersonalInfo, "Button 'Save Personal info'");

		if (manager.testModel().getBrowserName().equals(manager.config().BROWSER_IEXPLORER))
		{
			WebElement webElement = manager.wd().getWebElement(elements().btnSavePersonalInfo);
			wd().scrollWithOffset(webElement, 0, -200);
		}

		wd().click(elements().btnSavePersonalInfo);
	}

	public void clickCancelPersonalInfo()
	{
		log().info("Click cancel personal info");

		wd().waitForPresence(elements().btnCancelPersonalInfo, "Button 'Cancel Personal info'");

		if (manager.testModel().getBrowserName().equals(manager.config().BROWSER_IEXPLORER))
		{
			WebElement webElement = manager.wd().getWebElement(elements().btnCancelPersonalInfo);
			wd().scrollWithOffset(webElement, 0, -200);
		}

		wd().click(elements().btnCancelPersonalInfo);
	}

	public void clickEditLookingForInfo()
	{
		log().info("Click edit looking for");

		wd().waitForPresence(elements().btnEditLookingForInfo, "Button 'Edit Looking for'");

		if (manager.testModel().getBrowserName().equals(manager.config().BROWSER_IEXPLORER))
		{
			WebElement webElement = manager.wd().getWebElement(elements().btnEditLookingForInfo);
			wd().scrollWithOffset(webElement, 0, -200);
		}

		wd().click(elements().btnEditLookingForInfo);
	}

	public void clickSaveLookingForInfo()
	{
		log().info("Click save looking for");

		wd().waitForPresence(elements().btnSaveLookingForInfo, "Button 'Save Looking for'");

		if (manager.testModel().getBrowserName().equals(manager.config().BROWSER_IEXPLORER))
		{
			WebElement webElement = manager.wd().getWebElement(elements().btnSaveLookingForInfo);
			wd().scrollWithOffset(webElement, 0, -200);
		}

		wd().click(elements().btnSaveLookingForInfo);
	}

	public void clickCancelLookingForInfo()
	{
		log().info("Click cancel looking for");

		wd().waitForPresence(elements().btnCancelLookingForInfo, "Button 'Cancel Looking for'");

		if (manager.testModel().getBrowserName().equals(manager.config().BROWSER_IEXPLORER))
		{
			WebElement webElement = manager.wd().getWebElement(elements().btnCancelLookingForInfo);
			wd().scrollWithOffset(webElement, 0, -200);
		}

		wd().click(elements().btnCancelLookingForInfo);
	}

	public void clickEditAge()
	{
		log().info("Click edit age");

		wd().waitForPresence(elements().btnEditAge, "Button 'Edit age'");
		wd().click(elements().btnEditAge);
	}

	public void clickSaveAge()
	{
		log().info("Click save age");

		wd().waitForPresence(elements().btnSaveAge, "Button 'Save age'");
		wd().click(elements().btnSaveAge);
	}

	public void clickUndoAge()
	{
		log().info("Click undo age");

		wd().waitForPresence(elements().btnUndoAge, "Button 'Undo age'");
		wd().click(elements().btnUndoAge);
	}

	public void clickEditLocation()
	{
		log().info("Click edit location");

		wd().waitForPresence(elements().btnEditLocation, "Button 'Edit location'");
		wd().click(elements().btnEditLocation);
	}

	public void clickSaveLocation()
	{
		log().info("Click save location");

		wd().waitForPresence(elements().btnSaveLocation, "Button 'Save location'");
		wd().click(elements().btnSaveLocation);
	}

	public void clickUndoLocation()
	{
		log().info("Click undo location");

		wd().waitForPresence(elements().btnUndoLocation, "Button 'Undo location'");
		wd().click(elements().btnUndoLocation);
	}

	public void clickEditStatus()
	{
		log().info("Click edit status");

		wd().waitForPresence(elements().btnEditDescription, "Button 'Edit status'");
		wd().click(elements().btnEditDescription);
	}

	public void clickSaveStatus()
	{
		log().info("Click save status");

		wd().waitForPresence(elements().btnSaveDescription, "Button 'Save status'");
		wd().click(elements().btnSaveDescription);
	}

	public void clickUndoStatus()
	{
		log().info("Click undo status");

		wd().waitForPresence(elements().btnUndoDescription, "Button 'Undo status'");
		wd().click(elements().btnUndoDescription);
	}

	public void clickEditAbout()
	{
		log().info("Click edit about");

		wd().waitForPresence(elements().btnEditAbout, "Button 'Edit about'");
		wd().click(elements().btnEditAbout);
	}

	public void clickSaveAbout()
	{
		log().info("Click save about");

		wd().waitForPresence(elements().btnSaveAbout, "Button 'Save about'");
		wd().click(elements().btnSaveAbout);
	}

	public void clickUndoAbout()
	{
		log().info("Click undo about");

		wd().waitForPresence(elements().btnUndoAbout, "Button 'Undo about'");
		wd().click(elements().btnUndoAbout);
	}

	public void clickEditAppearance()
	{
		log().info("Click edit appearance");

		wd().waitForPresence(elements().btnEditAppearance, "Button 'Edit appearance'");
		wd().click(elements().btnEditAppearance);
	}

	public void clickSaveAppearance()
	{
		log().info("Click save appearance");

		wd().waitForPresence(elements().btnSaveAppearance, "Button 'Save appearance'");
		wd().click(elements().btnSaveAppearance);
	}

	public void clickUndoAppearance()
	{
		log().info("Click undo appearance");

		wd().waitForPresence(elements().btnUndoAppearance, "Button 'Undo appearance'");
		wd().click(elements().btnUndoAppearance);
	}

	public void clickEditLifestyle()
	{
		log().info("Click edit lifestyle");

		wd().waitForPresence(elements().btnEditLifestyle, "Button 'Edit lifestyle'");
		wd().click(elements().btnEditLifestyle);
	}

	public void clickSaveLifestyle()
	{
		log().info("Click save lifestyle");

		wd().waitForPresence(elements().btnSaveLifestyle, "Button 'Save lifestyle'");
		wd().click(elements().btnSaveLifestyle);
	}

	public void clickUndoLifestyle()
	{
		log().info("Click undo lifestyle");

		wd().waitForPresence(elements().btnUndoLifestyle, "Button 'Undo lifestyle'");
		wd().click(elements().btnUndoLifestyle);
	}

	public void clickEditBackground()
	{
		log().info("Click edit background");

		wd().waitForPresence(elements().btnEditBackground, "Button 'Edit background'");
		wd().click(elements().btnEditBackground);
	}

	public void clickSaveBackground()
	{
		log().info("Click save background");

		wd().waitForPresence(elements().btnSaveBackground, "Button 'Save background'");
		wd().click(elements().btnSaveBackground);
	}

	public void clickUndoBackground()
	{
		log().info("Click undo background");

		wd().waitForPresence(elements().btnUndoBackground, "Button 'Undo background'");
		wd().click(elements().btnUndoBackground);
	}

	public void clickEditLookingFor()
	{
		log().info("Click edit looking for");

		wd().waitForPresence(elements().btnEditLookingFor, "Button 'Edit looking for'");
		wd().click(elements().btnEditLookingFor);
	}

	public void clickSaveLookingFor()
	{
		log().info("Click save looking for");

		wd().waitForPresence(elements().btnSaveLookingFor, "Button 'Save looking for'");
		wd().click(elements().btnSaveLookingFor);
	}

	public void clickUndoLookingFor()
	{
		log().info("Click undo looking for");

		wd().waitForPresence(elements().btnUndoLookingFor, "Button 'Undo looking for'");
		wd().click(elements().btnUndoLookingFor);
	}

	public String getScreenname()
	{
		log().info("Get screenname");

		wd().waitForPresence(elements().txtScreenname, "Block 'Screenname'");

		if (manager.isFGF())
		{
			return wd().getAttribute(elements().txtScreenname, "value");
		}

		return wd().getText(elements().txtScreenname);
	}

	public void setBirthDay(ProfileDetails p_details)
	{
		log().info("Set birth day");

		wd().waitForPresence(elements().selectDay, "Select 'Birth day'");

		if (manager.isBN() || manager.isWB())
		{
			wd().selectItemInList(elements().blockActiveInputHolder, elements().selectDay, p_details.birthDay);
		}
		else if (manager.isFlirt())
		{
			wd().selectItemInList(elements().blockActiveField, elements().selectDay, p_details.birthDay);
		}
		else if (manager.isCNF() || manager.isLGW() || manager.isNF())
		{
			wd().selectByText(elements().selectDay, p_details.birthDay);
		}
		else if (manager.isMD())
		{
			wd().waitForPresence(elements().selectDay, "Day field");
			wd().click(elements().selectDay);
			wd().wait(1);
			wd().click(elements().setLocatorByValue(p_details.birthDay, elements().selectDay));
		}
	}

	public String getBirthDay()
	{
		log().info("Get birth day");

		wd().waitForPresence(elements().selectDay, "Select 'Birth day'");
		return wd().getText(elements().selectDay);
	}

	public void setBirthMonth(ProfileDetails p_details)
	{
		log().info("Set birth month");

		wd().waitForPresence(elements().selectMonth, "Select 'Birth month'");

		if (manager.isBN() || manager.isWB())
		{
			wd().selectItemInList(elements().blockActiveInputHolder, elements().selectMonth, dataModel.getNameOfValues(p_details.birthMonth));
		}
		else if (manager.isFlirt())
		{
			wd().selectItemInList(elements().blockActiveField, elements().selectMonth, dataModel.getNameOfValues(p_details.birthMonth));
		}
		else if (manager.isCNF() || manager.isLGW() || manager.isNF())
		{
			wd().selectByText(elements().selectMonth, dataModel.getNameOfValues(p_details.birthMonth));
		}
		else if (manager.isMD())
		{
			wd().waitForPresence(elements().selectMonth, "Month field");
			wd().click(elements().selectMonth);
			wd().wait(1);
			wd().click(elements().setLocatorByValue(p_details.birthMonth, elements().selectMonth));
		}
	}

	public String getBirthMonth()
	{
		log().info("Get birth month");

		wd().waitForPresence(elements().selectMonth, "Select 'Birth month'");
		return wd().getText(elements().selectMonth);
	}

	public void setBirthYear(ProfileDetails p_details)
	{
		log().info("Set birth Year");

		wd().waitForPresence(elements().selectYear, "Select 'Birth year'");

		if (manager.isBN() || manager.isWB())
		{
			wd().selectItemInList(elements().blockActiveInputHolder, elements().selectYear, p_details.birthYear);
		}
		else if (manager.isFlirt())
		{
			wd().selectItemInList(elements().blockActiveField, elements().selectYear, p_details.birthYear);
		}
		else if (manager.isCNF() || manager.isLGW() || manager.isNF())
		{
			wd().selectByText(elements().selectYear, p_details.birthYear);
		}
		else if (manager.isMD())
		{
			wd().waitForPresence(elements().selectYear, "Year field");
			wd().click(elements().selectYear);
			wd().wait(1);
			wd().click(elements().setLocatorByValue(p_details.birthYear, elements().selectYear));
		}
	}

	public String getBirthYear()
	{
		log().info("Get birth Year");

		wd().waitForPresence(elements().selectYear, "Select 'Birth year'");
		return wd().getText(elements().selectYear);
	}

	public String getAge()
	{
		log().info("Get age");

		if (manager.isFlirt() || manager.isMD())
		{
			wd().waitForPresence(elements().selectDay, "Select 'Birth day'");

			String p_age = calcAge(
				wd().getText(elements().selectYear),
				dataModel.getValuesOfName(wd().getText(elements().selectMonth)),
				wd().getText(elements().selectDay));

			return p_age;
		}

		wd().waitForPresence(elements().txtAge, "Block 'Age'");
		return wd().getText(elements().txtAge).substring(0, 2);
	}

	public void setLocation(ProfileDetails p_details)
	{
		log().info("Set location");

		wd().waitForPresence(elements().txtLocation, "Field 'Location'");

		if (manager.isMD())
		{
			wd().typeAndClear(elements().txtLocation, p_details.location);
		}
		else
		{
			wd().setElementText(elements().txtLocation, true, p_details.location);
		}
	}

	public String getLocation()
	{
		log().info("Get location");

		if (manager.isBN() || manager.isWB())
		{
			wd().waitForPresence(elements().txtLocationEdited, "Block 'Location'");
			return wd().getText(elements().txtLocationEdited);
		}

		wd().waitForPresence(elements().txtLocation, "Field 'Location'");
		return wd().getAttribute(elements().txtLocation, "value");
	}

	public void setDescription(ProfileDetails p_details)
	{
		log().info("Set description");

		wd().waitForPresence(elements().txtDescription, "Field 'Description'");
		wd().setElementText(elements().txtDescription, true, p_details.description);
	}

	public String getDescription()
	{
		log().info("Get description");

		if (manager.isBN() || manager.isWB())
		{
			wd().waitForPresence(elements().txtDescriptionEdited, "Block 'Description'");
			return wd().getText(elements().txtDescriptionEdited);
		}

		wd().waitForPresence(elements().txtDescription, "Field 'Description'");
		return wd().getText(elements().txtDescription);
	}

	public void setAboutMe(ProfileDetails p_details)
	{
		log().info("Set about me");

		wd().waitForPresence(elements().txtAboutMe, "Field 'About me'");
		wd().setElementText(elements().txtAboutMe, true, p_details.about);
	}

	public String getAboutMe()
	{
		log().info("Get about me");

		if (manager.isBN() || manager.isWB())
		{
			wd().waitForPresence(elements().txtAboutMeEdited, "Block 'About me'");
			return wd().getText(elements().txtAboutMeEdited);
		}

		wd().waitForPresence(elements().txtAboutMe, "Field 'About me'");
		return wd().getText(elements().txtAboutMe);
	}

	public void setHeight(ProfileDetails p_details)
	{
		log().info("Set height");

		wd().waitForPresence(elements().selectHeight, "Select 'Height'");

		if (manager.isBN() || manager.isWB() || manager.isFlirt())
		{
			wd().selectItemInList(elements().blockActiveField, elements().selectHeight, p_details.height);
		}
		else if (manager.isCNF() || manager.isLGW() || manager.isNF())
		{
			wd().selectByText(elements().selectHeight, p_details.height);
		}
		else if (manager.isMD())
		{
			this.setValueForMD(elements().selectHeight, p_details.height);
		}
	}

	public String getHeight()
	{
		log().info("Get height");

		wd().waitForPresence(elements().selectHeight, "Select 'Height'");

		if (manager.isBN() || manager.isWB())
		{
			return wd().getText(elements().selectHeightEdited);
		}

		if (manager.isFlirt() || manager.isMD())
		{
			return wd().getText(elements().selectHeight);
		}

		return wd().getTextElementInSelect(elements().selectHeight);
	}

	public void setWeight(ProfileDetails p_details)
	{
		log().info("Set weight");

		wd().waitForPresence(elements().selectWeight, "Select 'Weight'");

		if (manager.isBN() || manager.isWB() || manager.isFlirt())
		{
			wd().selectItemInList(elements().blockActiveField, elements().selectWeight, p_details.weight);
		}
		else if (manager.isCNF() || manager.isLGW() || manager.isNF())
		{
			wd().selectByText(elements().selectWeight, p_details.weight);
		}
		else if (manager.isMD())
		{
			this.setValueForMD(elements().selectWeight, p_details.weight);
		}
	}

	public String getWeight()
	{
		log().info("Get weight");

		wd().waitForPresence(elements().selectWeight, "Select 'Weight'");

		if (manager.isBN() || manager.isWB())
		{
			return wd().getText(elements().selectWeightEdited);
		}

		if (manager.isFlirt() || manager.isMD())
		{
			return wd().getText(elements().selectWeight);
		}

		return wd().getTextElementInSelect(elements().selectWeight);
	}

	public void setBodyType(ProfileDetails p_details)
	{
		log().info("Set body type");

		wd().waitForPresence(elements().selectBodyType, "Select 'Body type'");

		if (manager.isBN() || manager.isWB() || manager.isFlirt())
		{
			wd().selectItemInList(elements().blockActiveField, elements().selectBodyType, p_details.bodyType);
		}
		else if (manager.isCNF() || manager.isLGW() || manager.isNF())
		{
			wd().selectByText(elements().selectBodyType, p_details.bodyType);
		}
		else if (manager.isMD())
		{
			this.setValueForMD(elements().selectBodyType, p_details.bodyType);
		}
	}

	public String getBodyType()
	{
		log().info("Get body type");

		wd().waitForPresence(elements().selectBodyType, "Select 'Body type'");

		if (manager.isBN() || manager.isWB())
		{
			return wd().getText(elements().selectBodyTypeEdited);
		}

		if (manager.isFlirt() || manager.isMD())
		{
			return wd().getText(elements().selectBodyType);
		}

		return wd().getTextElementInSelect(elements().selectBodyType);
	}

	public void setHairColor(ProfileDetails p_details)
	{
		log().info("Set hair color");

		wd().waitForPresence(elements().selectHairColor, "Select 'Hair color'");

		if (manager.isBN() || manager.isWB() || manager.isFlirt())
		{
			wd().selectItemInList(elements().blockActiveField, elements().selectHairColor, p_details.hairColor);
		}
		else if (manager.isCNF() || manager.isLGW() || manager.isNF())
		{
			wd().selectByText(elements().selectHairColor, p_details.hairColor);
		}
		else if (manager.isMD())
		{
			this.setValueForMD(elements().selectHairColor, p_details.hairColor);
		}
	}

	public String getHairColor()
	{
		log().info("Get hair color");

		wd().waitForPresence(elements().selectHairColor, "Select 'Hair color'");

		if (manager.isBN() || manager.isWB())
		{
			return wd().getText(elements().selectHairColorEdited);
		}

		if (manager.isFlirt() || manager.isMD())
		{
			return wd().getText(elements().selectHairColor);
		}

		return wd().getTextElementInSelect(elements().selectHairColor);
	}

	public void setEyesColor(ProfileDetails p_details)
	{
		log().info("Set eyes color");

		wd().waitForPresence(elements().selectEyesColor, "Select 'Eyes color'");

		if (manager.isBN() || manager.isWB() || manager.isFlirt())
		{
			wd().selectItemInList(elements().blockActiveField, elements().selectEyesColor, p_details.eyesColor);
		}
		else if (manager.isCNF() || manager.isLGW() || manager.isNF())
		{
			wd().selectByText(elements().selectEyesColor, p_details.eyesColor);
		}
		else if (manager.isMD())
		{
			this.setValueForMD(elements().selectEyesColor, p_details.eyesColor);
		}
	}

	public String getEyesColor()
	{
		log().info("Get eyes color");

		wd().waitForPresence(elements().selectEyesColor, "Select 'Eyes color'");

		if (manager.isBN() || manager.isWB())
		{
			return wd().getText(elements().selectEyesColorEdited);
		}

		if (manager.isFlirt() || manager.isMD())
		{
			return wd().getText(elements().selectEyesColor);
		}

		return wd().getTextElementInSelect(elements().selectEyesColor);
	}

	public void setMaritalStatus(ProfileDetails p_details)
	{
		log().info("Set marital status");

		wd().waitForPresence(elements().selectMaritalStatus, "Select 'Marital status'");

		if (manager.isBN() || manager.isWB() || manager.isFlirt())
		{
			wd().selectItemInList(elements().blockActiveField, elements().selectMaritalStatus, p_details.maritalStatus);
		}
		else if (manager.isCNF() || manager.isLGW() || manager.isNF())
		{
			wd().selectByText(elements().selectMaritalStatus, p_details.maritalStatus);
		}
		else if (manager.isMD())
		{
			this.setValueForMD(elements().selectMaritalStatus, p_details.maritalStatus);
		}
	}

	public String getMaritalStatus()
	{
		log().info("Get marital status");

		wd().waitForPresence(elements().selectMaritalStatus, "Select 'Marital status'");

		if (manager.isBN() || manager.isWB())
		{
			return wd().getText(elements().selectMaritalStatusEdited);
		}

		if (manager.isFlirt() || manager.isMD())
		{
			return wd().getText(elements().selectMaritalStatus);
		}

		return wd().getTextElementInSelect(elements().selectMaritalStatus);
	}

	public void setChildren(ProfileDetails p_details)
	{
		log().info("Set children");

		wd().waitForPresence(elements().selectChildren, "Select 'Children'");

		if (manager.isBN() || manager.isWB() || manager.isFlirt())
		{
			wd().selectItemInList(elements().blockActiveField, elements().selectChildren, p_details.children);
		}
		else if (manager.isCNF() || manager.isLGW() || manager.isNF())
		{
			wd().selectByText(elements().selectChildren, p_details.children);
		}
		else if (manager.isMD())
		{
			this.setValueForMD(elements().selectChildren, p_details.children);
		}
	}

	public String getChildren()
	{
		log().info("Get children");

		wd().waitForPresence(elements().selectChildren, "Select 'Children'");

		if (manager.isBN() || manager.isWB())
		{
			return wd().getText(elements().selectChildrenEdited);
		}

		if (manager.isFlirt() || manager.isMD())
		{
			return wd().getText(elements().selectChildren);
		}

		return wd().getTextElementInSelect(elements().selectChildren);
	}

	public void setLiving(ProfileDetails p_details)
	{
		log().info("Set living");

		wd().waitForPresence(elements().selectLiving, "Select 'Living'");

		if (manager.isBN() || manager.isWB() || manager.isFlirt())
		{
			wd().selectItemInList(elements().blockActiveField, elements().selectLiving, p_details.living);
		}
		else if (manager.isCNF() || manager.isLGW() || manager.isNF())
		{
			wd().selectByText(elements().selectLiving, p_details.living);
		}
		else if (manager.isMD())
		{
			this.setValueForMD(elements().selectLiving, p_details.living);
		}
	}

	public String getLiving()
	{
		log().info("Get living");

		wd().waitForPresence(elements().selectLiving, "Select 'Living'");

		if (manager.isBN() || manager.isWB())
		{
			return wd().getText(elements().selectLivingEdited);
		}

		if (manager.isFlirt() || manager.isMD())
		{
			return wd().getText(elements().selectLiving);
		}

		return wd().getTextElementInSelect(elements().selectLiving);
	}

	public void setSmoke(ProfileDetails p_details)
	{
		log().info("Set smoke");

		wd().waitForPresence(elements().selectSmoke, "Select 'Smoke'");

		if (manager.isBN() || manager.isWB() || manager.isFlirt())
		{
			wd().selectItemInList(elements().blockActiveField, elements().selectSmoke, p_details.smoke);
		}
		else if (manager.isCNF() || manager.isLGW() || manager.isNF())
		{
			wd().selectByText(elements().selectSmoke, p_details.smoke);
		}
		else if (manager.isMD())
		{
			this.setValueForMD(elements().selectSmoke, p_details.smoke);
		}
	}

	public String getSmoke()
	{
		log().info("Get smoke");

		wd().waitForPresence(elements().selectSmoke, "Select 'Smoke'");

		if (manager.isBN() || manager.isWB())
		{
			return wd().getText(elements().selectSmokeEdited);
		}

		if (manager.isFlirt() || manager.isMD())
		{
			return wd().getText(elements().selectSmoke);
		}

		return wd().getTextElementInSelect(elements().selectSmoke);
	}

	public void setOrientation(ProfileDetails p_details)
	{
		log().info("Set orientation");

		wd().waitForPresence(elements().selectOrientation, "Select 'Orientation'");

		if (manager.isBN() || manager.isWB() || manager.isFlirt())
		{
			wd().selectItemInList(elements().blockActiveField, elements().selectOrientation, p_details.orientation);
		}
		else if (manager.isCNF() || manager.isLGW() || manager.isNF())
		{
			wd().selectByText(elements().selectOrientation, p_details.orientation);
		}
		else if (manager.isMD())
		{
			this.setValueForMD(elements().selectOrientation, p_details.orientation);
		}
	}

	public String getOrientation()
	{
		log().info("Get orientation");

		wd().waitForPresence(elements().selectOrientation, "Select 'Orientation'");

		if (manager.isBN() || manager.isWB())
		{
			return wd().getText(elements().selectOrientationEdited);
		}

		if (manager.isFlirt() || manager.isMD())
		{
			return wd().getText(elements().selectOrientation);
		}

		return wd().getTextElementInSelect(elements().selectOrientation);
	}

	public void setEthnicOrigin(ProfileDetails p_details)
	{
		log().info("Set ethnic origin");

		wd().waitForPresence(elements().selectEthnicOrigin, "Select 'Ethnic origin'");

		if (manager.isBN() || manager.isWB() || manager.isFlirt())
		{
			wd().selectItemInList(elements().blockActiveField, elements().selectEthnicOrigin, p_details.ethnicOrigin);
		}
		else if (manager.isCNF() || manager.isLGW() || manager.isNF())
		{
			wd().selectByText(elements().selectEthnicOrigin, p_details.ethnicOrigin);
		}
		else if (manager.isMD())
		{
			this.setValueForMD(elements().selectEthnicOrigin, p_details.ethnicOrigin);
		}
	}

	public String getEthnicOrigin()
	{
		log().info("Get ethnic origin");

		wd().waitForPresence(elements().selectEthnicOrigin, "Select 'Ethnic origin'");

		if (manager.isBN() || manager.isWB())
		{
			return wd().getText(elements().selectEthnicOriginEdited);
		}

		if (manager.isFlirt() || manager.isMD())
		{
			return wd().getText(elements().selectEthnicOrigin);
		}

		return wd().getTextElementInSelect(elements().selectEthnicOrigin);
	}

	public void setEducation(ProfileDetails p_details)
	{
		log().info("Set education");

		wd().waitForPresence(elements().selectEducation, "Select 'Education'");

		if (manager.isBN() || manager.isWB() || manager.isFlirt())
		{
			wd().selectItemInList(elements().blockActiveField, elements().selectEducation, p_details.education);
		}
		else if (manager.isCNF() || manager.isLGW() || manager.isNF())
		{
			wd().selectByText(elements().selectEducation, p_details.education);
		}
		else if (manager.isMD())
		{
			this.setValueForMD(elements().selectEducation, p_details.education);
		}
	}

	public String getEducation()
	{
		log().info("Get education");

		wd().waitForPresence(elements().selectEducation, "Select 'Education'");

		if (manager.isBN() || manager.isWB())
		{
			return wd().getText(elements().selectEducationEdited);
		}

		if (manager.isFlirt() || manager.isMD())
		{
			return wd().getText(elements().selectEducation);
		}

		return wd().getTextElementInSelect(elements().selectEducation);
	}

	public void setReligion(ProfileDetails p_details)
	{
		log().info("Set religion");

		wd().waitForPresence(elements().selectReligion, "Select 'Religion'");

		if (manager.isBN() || manager.isWB() || manager.isFlirt())
		{
			wd().selectItemInList(elements().blockActiveField, elements().selectReligion, p_details.religion);
		}
		else if (manager.isCNF() || manager.isLGW() || manager.isNF())
		{
			wd().selectByText(elements().selectReligion, p_details.religion);
		}
		else if (manager.isMD())
		{
			this.setValueForMD(elements().selectReligion, p_details.religion);
		}
	}

	public String getReligion()
	{
		log().info("Get religion");

		wd().waitForPresence(elements().selectReligion, "Select 'Religion'");

		if (manager.isBN() || manager.isWB())
		{
			return wd().getText(elements().selectReligionEdited);
		}

		if (manager.isFlirt() || manager.isMD())
		{
			return wd().getText(elements().selectReligion);
		}

		return wd().getTextElementInSelect(elements().selectReligion);
	}

	public void setTattoo(ProfileDetails p_details)
	{
		log().info("Set tattoo");

		wd().waitForPresence(elements().selectTattoo, "Select 'Tattoo'");

		if (manager.isBN() || manager.isWB() || manager.isFlirt())
		{
			wd().selectItemInList(elements().blockActiveField, elements().selectTattoo, p_details.tattoo);
		}
		else if (manager.isCNF() || manager.isLGW() || manager.isNF())
		{
			wd().selectByText(elements().selectTattoo, p_details.tattoo);
		}
		else if (manager.isMD())
		{
			this.setValueForMD(elements().selectTattoo, p_details.tattoo);
		}
	}

	public String getTattoo()
	{
		log().info("Get tattoo");

		wd().waitForPresence(elements().selectTattoo, "Select 'Tattoo'");

		if (manager.isBN() || manager.isWB())
		{
			return wd().getText(elements().selectTattooEdited);
		}

		if (manager.isFlirt() || manager.isMD())
		{
			return wd().getText(elements().selectTattoo);
		}

		return wd().getTextElementInSelect(elements().selectTattoo);
	}

	public void setPircing(ProfileDetails p_details)
	{
		log().info("Set pircing");

		wd().waitForPresence(elements().selectPircing, "Select 'Pircing'");

		if (manager.isBN() || manager.isWB() || manager.isFlirt())
		{
			wd().selectItemInList(elements().blockActiveField, elements().selectPircing, p_details.pircing);
		}
		else if (manager.isCNF() || manager.isLGW() || manager.isNF())
		{
			wd().selectByText(elements().selectPircing, p_details.pircing);
		}
		else if (manager.isMD())
		{
			this.setValueForMD(elements().selectPircing, p_details.pircing);
		}
	}

	public String getPircing()
	{
		log().info("Get pircing");

		wd().waitForPresence(elements().selectPircing, "Select 'Pircing'");

		if (manager.isBN() || manager.isWB())
		{
			return wd().getText(elements().selectPircingEdited);
		}

		if (manager.isFlirt() || manager.isMD())
		{
			return wd().getText(elements().selectPircing);
		}

		return wd().getTextElementInSelect(elements().selectPircing);
	}

	public void setDrink(ProfileDetails p_details)
	{
		log().info("Set drink");

		wd().waitForPresence(elements().selectDrink, "Select 'Drink'");

		if (manager.isBN() || manager.isWB() || manager.isFlirt())
		{
			wd().selectItemInList(elements().blockActiveField, elements().selectDrink, p_details.drink);
		}
		else if (manager.isCNF() || manager.isLGW() || manager.isNF())
		{
			wd().selectByText(elements().selectDrink, p_details.drink);
		}
		else if (manager.isMD())
		{
			this.setValueForMD(elements().selectDrink, p_details.drink);
		}
	}

	public String getDrink()
	{
		log().info("Get drink");

		wd().waitForPresence(elements().selectDrink, "Select 'Drink'");

		if (manager.isBN() || manager.isWB())
		{
			return wd().getText(elements().selectDrinkEdited);
		}

		if (manager.isFlirt() || manager.isMD())
		{
			return wd().getText(elements().selectDrink);
		}

		return wd().getTextElementInSelect(elements().selectDrink);
	}

	public void setIncome(ProfileDetails p_details)
	{
		log().info("Set income");

		wd().waitForPresence(elements().selectIncome, "Select 'Income'");

		if (manager.isBN() || manager.isWB() || manager.isFlirt())
		{
			wd().selectItemInList(elements().blockActiveField, elements().selectIncome, p_details.income);
		}
		else if (manager.isCNF() || manager.isLGW() || manager.isNF())
		{
			wd().selectByText(elements().selectIncome, p_details.income);
		}
		else if (manager.isMD())
		{
			this.setValueForMD(elements().selectIncome, p_details.income);
		}
	}

	public String getIncome()
	{
		log().info("Get income");

		wd().waitForPresence(elements().selectIncome, "Select 'Income'");

		if (manager.isBN() || manager.isWB())
		{
			return wd().getText(elements().selectIncomeEdited);
		}

		if (manager.isFlirt() || manager.isMD())
		{
			return wd().getText(elements().selectIncome);
		}

		return wd().getTextElementInSelect(elements().selectIncome);
	}

	public void setNativeLanguage(ProfileDetails p_details)
	{
		log().info("Set native language");

		wd().waitForPresence(elements().selectNativeLanguage, "Select 'Native language'");
		wd().selectByText(elements().selectNativeLanguage, p_details.nativeLanguage);
	}

	public String getNativeLanguage()
	{
		log().info("Get native language");

		wd().waitForPresence(elements().selectNativeLanguage, "Select 'Native language'");
		return wd().getTextElementInSelect(elements().selectNativeLanguage);
	}

	public String getSecondLanguage()
	{
		log().info("Get second language");

		wd().waitForPresence(elements().selectSecondLanguage, "Select 'Second language'");
		return wd().getTextElementInSelect(elements().selectSecondLanguage);
	}

	public void setHobbies(ProfileDetails p_details)
	{
		log().info("Set hobbies");

		wd().waitForPresence(elements().txtHobbies, "Field 'Hobbies'");
		wd().setElementText(elements().txtHobbies, true, p_details.description);
	}

	public String getHobbies()
	{
		log().info("Get hobbies");

		wd().waitForPresence(elements().txtHobbies, "Field 'Hobbies'");
		return wd().getText(elements().txtHobbies);
	}

	public void setPersonalInfo(ProfileDetails p_details)
	{
		this.setHeight(p_details);
		this.setWeight(p_details);
		this.setBodyType(p_details);
		this.setHairColor(p_details);
		this.setEyesColor(p_details);
		this.setMaritalStatus(p_details);
		this.setChildren(p_details);
		this.setLiving(p_details);
		this.setSmoke(p_details);
		this.setOrientation(p_details);
		this.setEthnicOrigin(p_details);
		this.setEducation(p_details);
		this.setReligion(p_details);
		this.setTattoo(p_details);
		this.setPircing(p_details);
		this.setDrink(p_details);
		this.setIncome(p_details);
	}

	public ProfileDetails getPersonalInfo()
	{
		ProfileDetails p_details = dataModel.new ProfileDetails();

		p_details.height = this.getHeight();
		p_details.weight = this.getWeight();
		p_details.bodyType = this.getBodyType();
		p_details.hairColor = this.getHairColor();
		p_details.eyesColor = this.getEyesColor();
		p_details.maritalStatus = this.getMaritalStatus();
		p_details.children = this.getChildren();
		p_details.living = this.getLiving();
		p_details.smoke = this.getSmoke();
		p_details.orientation = this.getOrientation();
		p_details.ethnicOrigin = this.getEthnicOrigin();
		p_details.education = this.getEducation();
		p_details.religion = this.getReligion();
		p_details.tattoo = this.getTattoo();
		p_details.pircing = this.getPircing();
		p_details.drink = this.getDrink();
		p_details.income = this.getIncome();

		return p_details;
	}

	public String getLookingGender()
	{
		log().info("Get looking gender");

		wd().waitForPresence(elements().selectLookingGender, "Select 'Looking gender'");

		if (manager.isBN() || manager.isWB())
		{
			return wd().getText(elements().selectLookingGenderEdited).toLowerCase();
		}

		if (manager.isFlirt() || manager.isMD())
		{
			return wd().getText(elements().selectLookingGender).toLowerCase();
		}

		return wd().getTextElementInSelect(elements().selectLookingGender).toLowerCase();
	}

	public String getLookingAgeFrom()
	{
		log().info("Get looking age from");

		wd().waitForPresence(elements().selectLookingAgeFrom, "Select 'Looking age from'");

		if (manager.isBN() || manager.isWB())
		{
			String p_text = wd().getText(elements().selectLookingAgeEdited);
			return manager.string().getSubstringBefore(p_text, "-");
		}

		if (manager.isFlirt() || manager.isMD())
		{
			return wd().getText(elements().selectLookingAgeFrom);
		}

		return wd().getTextElementInSelect(elements().selectLookingAgeFrom);
	}

	public String getLookingAgeTo()
	{
		log().info("Get looking age to");

		wd().waitForPresence(elements().selectLookingAgeTo, "Select 'Looking age to'");

		if (manager.isBN() || manager.isWB())
		{
			String p_text = wd().getText(elements().selectLookingAgeEdited);
			return manager.string().getSubstringAfter(p_text, "-");
		}

		if (manager.isFlirt() || manager.isMD())
		{
			return wd().getText(elements().selectLookingAgeTo);
		}

		return wd().getTextElementInSelect(elements().selectLookingAgeTo);
	}

	public String getLookingLocation()
	{
		log().info("Get looking location");

		if (manager.isBN() || manager.isWB())
		{
			wd().waitForPresence(elements().txtLookingLocationEdited, "Block 'Looking location'");
			return wd().getText(elements().txtLookingLocationEdited);
		}

		wd().waitForPresence(elements().txtLookingLocation, "Block 'Looking location'");
		return wd().getAttribute(elements().txtLookingLocation, "value");
	}

	public String getLookingDistance()
	{
		log().info("Get looking distance");

		wd().waitForPresence(elements().selectLookingDistance, "Select 'Looking distance'");
		return wd().getText(elements().selectLookingDistance).substring(0, 3).trim();
	}

	public void waitForPageLoad()
	{
		log().info("Wait for myProfile page load");
		wd().waitForPresence(elements().txtScreenname, "Block 'Screenname'");
	}

	public boolean isAvatarPresent()
	{
		log().info("Get avatar data");

		wd().waitForPresence(elements().blockAvatarUpload, "Block 'Avatar'");
		return (wd().isElementPresent(elements().blockAvatarUpload));
	}

	public void clickUploadPhotoMenu()
	{
		log().info("Click menu upload photo");

		wd().waitForVisibility(elements().btnUploadPhotoMenu, "Button 'Photo menu'", false);
		wd().click(elements().btnUploadPhotoMenu);
	}

	private String calcAge(String p_day, String p_month, String p_year)
	{
		return String.valueOf(manager.cronos().getDiffYears(Integer.valueOf(p_day), Integer.valueOf(p_month), Integer.valueOf(p_year)));
	}

	public void uploadPhoto()
	{
		log().info("Upload photo");

		wd().waitForPresence(elements().blockPhotoUploader, "Block 'Photo Uploader'");

		String photo = null;

		switch (manager.testUser().getGender())
		{
			case "male":
			{
				photo = manager.file().setWaterMark(ConfigExt.UPLOAD_PHOTO_MALE);
				break;
			}

			case "female":
			{
				photo = manager.file().setWaterMark(ConfigExt.UPLOAD_PHOTO_FEMALE);
				break;
			}
		}

		wd().uploadFile(elements().inputFile, photo);
	}

	public void removePhoto()
	{
		log().info("Remove photo");

		wd().waitForPresence(elements().blockPrimaryPhoto, "Block 'Primary photo'");
		wd().wait(5); // JS load

		if (!manager.isFlirt() && !manager.isMD())
		{
			WebElement blockPhotoImage = wd().getWebElement(elements().blockPrimaryPhoto);

			if (manager.isCNF() || manager.isLGW() || manager.isNF())
			{
				wd().scrollWithOffset(blockPhotoImage, 0, -200);
				wd().wait(1);
			}

			manager.actionBuilder().mouseOver(blockPhotoImage);
			wd().wait(5); // JS load
		}

		this.clickRemovePhoto();
		wd().wait(30); // JS load
	}

	public boolean isPhotoPresent()
	{
		return wd().isElementPresent(elements().blockPrimaryPhoto);
	}

	public void waitForPhotoElement()
	{
		wd().waitForPresence(elements().blockPrimaryPhoto, "Block 'Photo Image'");
	}

	public void clickRemovePhoto()
	{
		log().info("Click Remove photo");

		if (manager.isFlirt() || manager.isMD() || manager.isWB() || manager.isBN() || manager.isNF())
		{
			wd().clickByJS(elements().btnRemovePhoto);
			return;
		}

		wd().click(elements().btnRemovePhoto);
	}

	public void setFormLookingFor(LookingFor p_lookingForParams)
	{
		this.setLookingGender(p_lookingForParams);
		this.setLookingLocation(p_lookingForParams);
		this.setLookingAgeFrom(p_lookingForParams);
		this.setLookingAgeTo(p_lookingForParams);
		this.setLookingDistance(p_lookingForParams);

	}

	public void setLookingGender(LookingFor p_lookingForParams)
	{
		log().info("Set looking gender");

		String p_digitValue = (p_lookingForParams.gender.equals("male")) ? "1" : "2";
		String p_stringValue = (p_lookingForParams.gender.equals("male")) ? "Male" : "Female";

		wd().waitForPresence(elements().selectLookingGender, "Select 'Looking gender'");

		if (manager.isBN() || manager.isWB() || manager.isFlirt())
		{
			wd().selectItemInList(elements().blockActiveField, elements().selectLookingGender, p_stringValue);
		}
		else if (manager.isCNF() || manager.isLGW())
		{
			wd().selectByText(elements().selectLookingGender, p_stringValue);
		}
		else if (manager.isMD() || manager.isNF())
		{
			this.scrollToVisibleFrame(elements().selectLookingGender);
			wd().wait(1);
			wd().click(elements().selectLookingGender);
			wd().wait(1);
			this.scrollToVisibleFrame(elements().selectGender(p_digitValue));
			wd().click(elements().selectGender(p_digitValue));
			wd().wait(1);
		}
	}

	public void setLookingLocation(LookingFor p_lookingFor)
	{
		log().info("Set looking location");

		wd().waitForPresence(elements().txtLookingLocation, "Field 'Looking location'");

		if (manager.isMD())
		{
			wd().typeAndClear(elements().txtLookingLocation, p_lookingFor.location);
			wd().wait(2);
			wd().click(elements().txtLookingLocation);
		}
		else if (manager.isNF())
		{
			this.scrollToVisibleFrame(elements().txtLookingLocation);
			wd().typeAndClear(elements().txtLookingLocation, p_lookingFor.location);
		}
		else
		{
			wd().setElementText(elements().txtLookingLocation, true, p_lookingFor.location);
		}
	}

	public void setLookingDistance(LookingFor p_lookingForParams)
	{
		log().info("Set looking distance");

		wd().waitForPresence(elements().selectLookingDistance, "Select Looking distance");

		if (manager.isMD() || manager.isNF())
		{
			this.scrollToVisibleFrame(elements().selectLookingDistance);
			wd().click(elements().selectLookingDistance);
			wd().wait(2);
			wd().click(elements().selectRadius(p_lookingForParams.distance));
		}
		else
		{
			wd().selectByText(elements().selectLookingDistance, p_lookingForParams.distance);
		}
	}

	public void setLookingAgeTo(LookingFor p_lookingForParams)
	{
		log().info("Set looking age to");

		wd().waitForPresence(elements().selectLookingAgeTo, "Select 'Looking age to'");

		if (manager.isBN() || manager.isWB())
		{
			wd().selectItemInList(elements().blockActiveField, elements().selectLookingAgeTo, p_lookingForParams.ageTo);
		}
		else if (manager.isFlirt())
		{
			wd().selectItemInList(elements().blockActiveRange, elements().selectLookingAgeTo, p_lookingForParams.ageTo);
		}
		else if (manager.isMD())
		{
			this.scrollToVisibleFrame(elements().selectLookingAgeTo);
			wd().click(elements().selectLookingAgeTo);
			wd().click(elements().setLocatorByValue(p_lookingForParams.ageTo, elements().selectLookingAgeTo));
		}
		else if (manager.isCNF() || manager.isLGW() || manager.isNF())
		{
			wd().selectByText(elements().selectLookingAgeTo, p_lookingForParams.ageTo);
		}
	}

	public void setLookingAgeFrom(LookingFor p_params)
	{
		log().info("Set looking age from");

		wd().waitForPresence(elements().selectLookingAgeFrom, "Select 'Looking age from'");

		if (manager.isBN() || manager.isWB())
		{
			wd().selectItemInList(elements().blockActiveField, elements().selectLookingAgeFrom, p_params.ageFrom);
		}
		else if (manager.isFlirt())
		{
			wd().selectItemInList(elements().blockActiveRange, elements().selectLookingAgeFrom, p_params.ageFrom);
		}
		else if (manager.isCNF() || manager.isLGW() || manager.isNF())
		{
			wd().selectByText(elements().selectLookingAgeFrom, p_params.ageFrom);
		}
		else if (manager.isMD())
		{
			this.scrollToVisibleFrame(elements().selectLookingAgeFrom);
			wd().click(elements().selectLookingAgeFrom);
			wd().click(elements().setLocatorByValue(p_params.ageFrom, elements().selectLookingAgeFrom));
		}
	}

	public void submitLookingForm()
	{
		wd().waitForPresence(elements().btnSaveLookingFor, "Submit Looking for");
		wd().click(elements().btnSaveLookingFor);
	}

	/**
	 * MD related
	 */
	public void clickLookingForBlock()
	{
		wd().waitForPresence(elements().btnEditLookingForInfo, "Block Looking for");
		wd().click(elements().btnEditLookingForInfo);
	}

	/**
	 * MatureDating Private Info
	 * @param p_locator
	 * @param p_value
	 */
	private void setValueForMD(By p_locator, String p_value)
	{
		wd().scrollTo(p_locator);
		wd().wait(1);
		wd().click(p_locator);
		wd().wait(1);
		wd().scrollTo(elements().dropDownLocator(p_locator, p_value));
		wd().wait(1);
		wd().click(elements().dropDownLocator(p_locator, p_value));
		wd().wait(1);
	}

	public void scrollToVisibleFrame(By p_locator)
	{
		log().info("Scroll to view");
		wd().scrollToBy(p_locator, 5, false);
	}
}
